import BaseApi from "../base.api";

export default class UploadFileApi extends BaseApi {
  protected baseUri = "/backend/file";

  uploadFile(file: any, directoryId: number) {
    const config = {
      headers: { "Content-Type": "multipart/form-data" },
    };
    return this.request.post(`${this.baseUri}/upload?directoryId=${directoryId}`, file, config);
  }

  listFile(directoryId: number) {
    return this.request.get(`${this.baseUri}/list?directoryId=${directoryId}`);
  }

  deleteById(treeId: number) {
    return this.request.delete(`${this.baseUri}/delete?treeId=${treeId}`);
  }
}
